<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover" />
    <title>所属企业</title>
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <link rel="stylesheet" href="/addons/jquery-weui-build/css/weui.min.css">
    <link rel="stylesheet" href="/addons/jquery-weui-build/css/jquery-weui.css">
    <link rel="stylesheet" href="/css/system/front-iconfont.css?v=2018121301">
    @if($skinid == 3)
        <link rel="stylesheet" href="/css/system/common.css">
        <link rel="stylesheet" href="/css/system/user-company.css">
    @elseif($skinid == 1)
        <link rel="stylesheet" href="/css/theme-blue/system/common.css">
        <link rel="stylesheet" href="/css/theme-blue/system/user-company.css">
    @elseif($skinid == 2)
        <link rel="stylesheet" href="/css/theme-pink/system/common.css">
        <link rel="stylesheet" href="/css/theme-pink/system/user-company.css">
    @endif
</head>
<body ontouchstart>
<div class="user-company">
    <h3 class="company-title">{{$company->name}}</h3>
    <div class="weui-cells">
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <p>企业全称</p>
            </div>
            <div class="weui-cell__bd">
                {{$company->name}}
            </div>
            <div class="weui-cell__ft">
                @if($skinid == 3)
                    <img src="/img/com-img.png">
                @elseif($skinid == 1)
                    <img src="/img-theme-blue/com-img.png">
                @elseif($skinid == 2)
                    <img src="/img-theme-pink/com-img.png">
                @endif
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <p>企业口号</p>
            </div>
            <div class="weui-cell__ft">
                {{$company->slogan}}
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <p>创建时间</p>
            </div>
            <div class="weui-cell__ft">
                {{$company->created_at->format('Y-m-d')}}
            </div>
        </div>
        {!! csrf_field() !!}
        <input type="hidden" name="comid" value="{{$company->id}}">
        {{--<div class="weui-cell">
            <div class="weui-cell__hd">
                <p>创建人</p>
            </div>
            <div class="weui-cell__ft">
                衣晓辉
            </div>
        </div>--}}
    </div>
    <a href="javascript:;" class="weui-btn weui-btn_warn set-out">退出企业</a>
</div>
<script src="/js/jquery-2.1.4.min.js"></script>
<script src="/addons/jquery-weui-build/js/fastclick.js"></script>
<script>
    $(function() {
        document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
        FastClick.attach(document.body);
    });
</script>
<script src="/addons/jquery-weui-build/js/jquery-weui.min.js"></script>
<script>
    $(document).ready(function () {
        var token = $('input[name=_token]').val();
        var comid = $('input[name=comid]').val().trim();
        $('.set-out').click(function () {
            $.confirm({
                title: '确认退出',
                text: '确认退出企业，并解除企业关系',
                onOK: function () {
                    $.ajax({
                        'url': '/front/quit-company?_token='+token,
                        'type': 'POST',
                        'data': 'comid='+comid,
                        'dataType': "json",
                        error: function (request) {
                            $.toast('网络错误',"text");
                        },
                        success: function (data) {
                            if (data.status == 'success') {
                                $.toast(data.msg);
                                window.location.href=data.redirectUrl;
                            } else {
                                $.toast(data.msg,"text");
                            }
                        },
                    });

                },
                onCancel: function () {
                }
            });
        })
    })
</script>
</body>
</html>